Exception Stack Trace

When debugging my Java programs, it is very usefull to have stack trace information.
Ant do not provide always this information
The following class will generate the "Unknown Source" trace


public class ExceptionTest {
 
    public static void fonction2() {
        //generate Exception stack trace
        Thread.dumpStack(); 
    }
 
    public static void fonction1() {
        fonction2(); 
    }
 
    public static void main(String[] args) {
        fonction1(); 
    }
}

java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Thread.java:1342)
        at ExceptionTest.fonction2(Unknown Source)
        at ExceptionTest.fonction1(Unknown Source)
        at ExceptionTest.main(Unknown Source)
                

To fix this issue, correct the following ant script


<!-- build.xml -->
<project name="TestProject" default="build" basedir=".">
 <target name="build">
  <javac srcdir="." destdir="."/>
 </target>
</project>

by this script


<!-- build.xml -->
<project name="TestProject" default="build" basedir=".">
 <target name="build">
  <javac srcdir="." destdir="." debug="on"/>
 </target>
</project>


java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Thread.java:1342)
        at ExceptionTest.fonction2(ExceptionTest.java:7)
        at ExceptionTest.fonction1(ExceptionTest.java:11)
        at ExceptionTest.main(ExceptionTest.java:15)